<meta charset="UTF-8">
  <div class="content-wrapper">
    <section class="content-header">
      <h1 style="text-align:center">
        	智能发布
      </h1>
    </section>
    <section class="content" style='position: relative;padding: 0;'> 
         <div class="panel-body" style="padding-bottom:0px;padding: 0;width: 98%;margin: 0px 0px 0px 5px	;">
						<div class="row searchdiv" style='    padding: 0px 10px 0px 30px;'>
							<div class="form-group col-lg-3 col-xs-6 space" style='display: inline-block;width: auto;vertical-align: middle;'>
										<label style='width: 60px;display: inline-block;'>发布餐别</label>
									 <select style='width: 150px;display: inline-block;' class="form-control" ng-model="mealStyle" ng-options='meal.period_time_id as meal.period_time_name for meal in mealStyles'></select>
								</div>
							<!--<div class="form-group col-lg-2 col-xs-6 space">
								<div class="input-group date">
								  <input type="text" class="form-control pull-right" id="datepicker">
								  <div class="input-group-addon">
									<i class="fa fa-calendar"></i>
								  </div>
								</div>
							</div>
							<div class="form-group col-lg-2 col-xs-6 space">
								<div class="input-group date">
								  <input type="text" class="form-control pull-right" id="datepicker2">
								  <div class="input-group-addon">
									<i class="fa fa-calendar"></i>
								  </div>
								</div>
							</div>-->
							<div class='form-group col-md-3' style='width: 340px;'>
								<label style='width: 60px;display: inline-block;margin: 6px 0px 0px 0px;float: left;'>发布时间</label>
								<div class="form-group col-lg-2 col-xs-6 space" style='width: 110px;padding-right: 0px;'>
									<div class="input-group date">
									  <input type="text" class="form-control pull-right" id="datepicker" >
									</div>
								</div>
							<div style='display: inline-block;width: 20px;height: 34px;line-height:34px;text-align: center;float: left;'>至</div>
							<div class="form-group col-lg-2 col-xs-6 space" style='width: 110px;padding-left: 0px;'>
								<div class="input-group date">
								  <input type="text" class="form-control pull-right" id="datepicker2" >
								</div>
							</div>	
							 	<!--<input type="text" class="form-control pull-right" id="reservation" ng-model="searchDate" style='text-align: center;width: 200px;display: inline-block;'>-->
							 </div>
								<div class="form-group col-lg-2 col-xs-6 space" style='display: inline-block;width: 200px;vertical-align: middle;position: relative;margin: 5px 0px;'>
										<div style='display: inline-block;'>周末排单</div>
										<div style='display: inline-block;'>
												<input type="checkbox" name='planWeekend' value='0'/>
												<span>周六</span>
										</div>
										<div style='display: inline-block;'>
												<input type="checkbox" name='planWeekend' value='1'/>
												<span>周日</span>
										</div>
			     			 </div>
			     			 <!--<button style='margin-right: 3%;' class="btn pull-right" ng-click="download('busColTable')"><i class="fa fa-cloud-download"></i>&nbsp;&nbsp;导出</button>-->
			   					<div style='float: right;margin-right: 2%;height: 35px;line-height: 35px;background-color:#3c8dbc;color: #fff;font-size: 16px;
			   						cursor: pointer;width: 60px;text-align: center;border-radius: 3px;' ng-click='toPublish()'>
			   						保存
			   					</div>
						</div>
			   
			<!--表格-->
            <div class="box-body" style='padding: 0px;'>
              <div  class="dataTables_wrapper form-inline dt-bootstrap"><div class="row"><div class="col-sm-6"></div><div class="col-sm-6"></div></div><div class="row"><div class="col-sm-12">
              	<table id='busColTable' style='border: 1px solid #ccc;width: 100%; position: relative;overflow: auto;height:90%; display: block;background: #ffffff;' class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
	                <thead style='display: inline-table;width: 100%;margin-top: -5px;margin-bottom: -17px;border: 1px solid #ddd;'>
		                <tr role="row">
		                	<th    style="width: 8%;border: none;">菜品类别</th>
		                	<th  style="width: 8%;border: none;">菜品总数量</th>
		                	<th   style="width: 10%;border: none;">发布总数量</th>
		                	<th  style="width: 25%;border: none;">固定发布菜品</th>
		                	<th   style="width: 8%;border: none;">剩余发布数量</th>
		                	<th   style="width: 20%;border: none;">发布方式</th>
		                </tr>
	                </thead>
	              <tbody style='display: inline-table;width: 100%;background-color: #fff !important;border: none;margin-top: 17px;'>
			                <tr ng-class="{even:!$even, odd:!$odd}" style='position: relative;width: 100%;height:40px;display: inline-table;' ng-class="{even:!$even, odd:!$odd}" ng-repeat="p in intelPublish">
				                  <td style="width: 8%;border: none;line-height: 40px;">{{p.name}}</td>
				                  <td style="width: 8%;border: none;line-height: 40px" >{{p.count}}</td>
				                  <td style="width: 10%;border: none;">
				                  	<input  id='totalNum_{{p.id}}' ng-model='p.totalNum' ng-keyup='change(p.id)'  type="number" style='border: 1px solid #E6E6E6;border-radius: 4px;height: 40px;width: 90px;text-align: center;'/>
				                  </td>
				                  <td style="width: 25%;border: none;">
				                  	
				                  	
				                  	
				                  	<input id='choicedDish_{{p.id}}' ng-click='openSelectDishs(p.id,$event,p.name)' type="text" style='border: 1px solid #E6E6E6;border-radius: 4px;height: 40px;width: 90%;' readonly/>
				                  	<!--<div id='choicedDish_{{p.categoryId}}' ng-click='openSelectDishs(p.categoryId,$event,p.category)'  style='border: 1px solid #E6E6E6;border-radius: 4px;height: 40px;width: 90%;'>
				                  			<span ng-repeat='choi in choices() track by $index'>{{choi.name}}</span>
				                  	</div>-->
				                  </td>
				                  <td style="width: 8%;border: none;line-height: 40px"> 
				                  	<span id='remain_{{p.id}}'>{{p.balanceNum}}</span> 
				                  </td>
								  				<td style="width: 20%;border: none;" > 
								  						<div> 
								  							<button ng-click='clickButton(p.id,$event,0)' class='mybtn mychoice' style='border-radius: 5px 0px 0px 5px;margin-right: -3px;'>每日相同菜品</button>
								  							<button ng-click='clickButton(p.id,$event,1)' class='mybtn' style='border-radius: 0px 5px 5px 0px;'>每日随机菜品</button>
								  						</div>
								  				</td>
			                </tr>
	                </tbody>
              </table>
              </div>
              </div>
              </div>
           </div>
	</section> 
</div>

<!-- 选择固定发布菜品modal --> 
<div class="modal fade" id="selectDishs" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center" >{{categoryName}}-选择固定菜品</h4>
      </div>
     <!--表格-->
              	<div class="row">
              	<table style='margin: 0px 5% 0px 5%; width: 90%; position: relative;overflow: auto; display: block;background: #ffffff;height:440px' id="example1" 
              		class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info"><!--min-height: 300px; max-height: 500px;-->
                <thead style='display: inline-table;width: 100%;'>
	                <tr role="row">
	                	<th  style="width: 10%;">菜品名称</th>
	                	<th  style="width: 10%;">单位</th>
	                	<th  style="width: 10%;">操作</th>
	                </tr>
                </thead>
              <tbody id='chiefSelected' style='display: inline-table;width: 100%;' > 
		                <tr ng-click="chiefSelected($event)" style='position: relative;width: 100%;display: inline-table;' ng-class="{even:!$even, odd:!$odd}" ng-repeat="item in dishs">
			                  <td style="width: 10%;" >{{item.name}}</td>  
			                  <td style="width: 10%;">{{item.unit_name}}</td> 
			                  <td style="width: 10%;">
			                  	<input ng-change='checkDish(item.category_id,item.id,item.name)' ng-model='item.checked'  type="checkbox" name='cc_{{item.category_id}}' value='{{item.id}}' ng-data-name='{{item.name}}'/><!--ng-change='checkDish(item.category_id,item.id)'-->
			                  </td>
		                </tr>
                </tbody>
                <tfoot>
                </tfoot> 
              </table>
              </div>
      <!--<div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="trueSelectChief()">确定</button>
      </div>-->
    </div>
  </div>
</div>

<style>
	.space{
		padding-left:2px;
		padding-right:2px;
	}
	.box{
		border-top:1px solid #d2d6de;
	}
	.pagination{
		margin:0;
	}
	.odd{background-color: #f9f9f9 !important;}
	.even{background-color: transparent !important;}
	.btn{    padding: 10px 12px;}
	.mybtn{height: 40px;border: 1px solid #ccc;color: #37C8D2;background-color: #FFFFFF;border: 1px solid #37C8D2;}
	.mychoice{color: #FFFFFF;background-color: #37C8D2;border: 1px solid #37C8D2;}
</style>
<script>
					$(document).ready(function() {
							
//							$('#table_example').hide();
  							//$('#example').dataTable();
					} );
					
				
	
</script>